package com.naiterui.ehp.bs.patient.controller.inner;

import com.naiterui.ehp.bp.bo.patient.ConvertWxImageBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.patient.service.function.IFunctionService;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author gaoliangliang
 * @date 2019/11/28 2:11 下午
 * @since 1.0.0
 */
@Api(tags = {SwaggerTag.PATIENT + SwaggerTag.INNER_API + SwaggerTag.OTHER})
@RestController
@RequestMapping("ap/inner/wx")
@AllArgsConstructor
public class ApInnerWxfileController {

    private final IFunctionService functionService;

    @PostMapping("convert/image")
    public ResponseVO<List<ConvertWxImageBO>> convertImage(@RequestBody List<ConvertWxImageBO> convertWxImageList) {
        List<ConvertWxImageBO> result = functionService.convertImage(convertWxImageList);
        functionService.syncImageFile(result);
        return PublicService.returnResponseVO(result);
    }

}
